package com.ny.demo0526;


public class Emp {
    //员工工号
    private String number;
    //员工姓名
    private String name;
    //员工年龄
    private int age;


    public Emp(String number, String name, int age) {
        this.number = number;
        this.name = name;
        this.age = age;
        System.out.println(0);
    }


    public Emp() {
        System.out.println("1");
    }

    //获取员工工号
    public String getNumber() {
        return number;
    }

    //设置员工工号
    public void setNumber(String number) {
        this.number = number;
    }

    //获取员工姓名
    public String getName() {
        return name;
    }

    //设置员工姓名
    public void setName(String name) {
        this.name = name;
    }

    //获取员工年龄
    public int getAge() {
        return age;
    }

    //设置员工年龄
    public void setAge(int age) {
        this.age = age;
    }


    @Override
    public String toString() {
        return "Emp{" + "number='" + number + '\'' + ",name='" + name + '\'' + ", age=" + age + '}';
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Emp emp = (Emp) o;
        return number.equals(emp.number);
    }


    @Override
    public int hashCode() {
        return number.hashCode();
    }
}